import request from '@/utils/request';

const fileApi = {};

fileApi.download = (id) => {
	return request({
		url: '/api/file/download/' + id,
		method: 'get',
	},{
		responseType: "blob",
	})
}
fileApi.listByUserId = (userId) => {
	return request({
		url: '/api/file/list/' + userId,
		method: 'get',
	})
}

fileApi.list = (workspaceId, parentId) => {
	return request({
		url: '/api/file/list/' + workspaceId + "/" + parentId,
		method: 'get',
	})
}
fileApi.addDir = (params) => {
	return request({
		url: '/api/file/add-dir',
		method: 'post',
		data: params,
	})
}
fileApi.rename = (params) => {
	return request({
		url: '/api/file/rename',
		method: 'post',
		data: params,
	})
}
fileApi.delete = (id) => {
	return request({
		url: '/api/file/' + id,
		method: 'delete',
	})
}

export default fileApi